function t(t, e) {
    if (t && e) {
        for (var n = t.split("."), o = e.split("."), i = Math.min(n.length, o.length), a = 0, d = 0; a < i && 0 == (d = parseInt(n[a]) - parseInt(o[a])); ) a++;
        return (d = 0 != d ? d : n.length - o.length) >= 0;
    }
    return console.log("版本号不能为空"), !1;
}

var e, n = function(t) {
    return t && t.__esModule ? t : {
        default: t
    };
}(require("../../../utils/tools.js")), o = getApp();

Page({
    data: {
        showPopup: !1,
        videoAd2: "",
        hasvideoAd2: !1,
        interstitialAd: "",
        audit_model: !0
    },
    onLoad: function() {
        e = this;
    },
    onUnload: function() {
        console.log(888), e.data.hasvideoAd2;
    },
    onHide: function() {
        console.log(8885), e.data.hasvideoAd2;
    },
    onReady: function() {
        var o = {
            action: "index",
            contr: "sigin",
            token: wx.getStorageSync("token")
        };
        n.default.request(o, function(n) {
            e.setData(n.info), 1 != wx.getStorageSync(n.info.time + "token") && (wx.setStorageSync(n.info.time + "token", 1), 
            e.setData({
                showPopup: !0
            }));
            var o = wx.getSystemInfoSync();
            console.log(6969696), e.data.videoAd2 = null, console.log(n.info.ad.adUnitId), console.log(t(o.SDKVersion, "2.0.4")), 
            n.info.ad.adUnitId && t(o.SDKVersion, "2.6.0") && (console.log(99999999), e.setData({
                ad_load: !0
            }), e.data.videoAd2 = wx.createRewardedVideoAd({
                adUnitId: n.info.ad.adUnitId
            })), wx.createInterstitialAd && n.info.ad.signin_screen_ad && "" == e.data.interstitialAd && (e.data.interstitialAd = wx.createInterstitialAd({
                adUnitId: n.info.ad.signin_screen_ad
            }), e.data.interstitialAd.onError(function(t) {
                console.log(t);
            }), e.data.interstitialAd.show().catch(function(t) {
                console.error(t);
            }));
        });
    },
    closeTap: function() {
        e.setData({
            showPopup: !1
        });
    },
    videoAd2Show: function() {
        var t = this;
        if (this.data.videoAd2) {
            wx.getSystemInfoSync();
            this.data.videoAd2.show(), this.data.videoAd2.onClose(function(o) {
                if (t.data.videoAd2 && (t.data.videoAd2.offClose(), o && o.isEnded || void 0 === o)) {
                    var i = {
                        action: "double",
                        contr: "sigin",
                        token: wx.getStorageSync("token")
                    };
                    n.default.request(i, function(t) {
                        wx.showToast({
                            icon: "none",
                            title: "获得" + e.data.sigin.water_number + "g" + e.data.water_name + "~"
                        }), e.setData({
                            showPopup: !1
                        });
                    });
                }
            });
        }
    },
    signRemind: function(t) {
        var o = {
            action: "remind",
            contr: "sigin",
            token: wx.getStorageSync("token"),
            formid: t.detail.formId
        };
        n.default.request(o, function(t) {
            e.data.sigin.is_remind = t.info.is_remind, e.setData({
                sigin: e.data.sigin
            });
        });
    },
    onShow: function() {},
    goMessageList: function() {
        var t = o.siteInfo.siteroot + "?i=" + o.siteInfo.uniacid + "&from=wxapp&c=entry&a=wxapp&do=questionList&m=bh_prise";
        wx.setStorageSync("discovery_h5url", t), wx.navigateTo({
            url: "/bh_prise/pages/discoveryH5/discoveryH5"
        });
    },
    getPhoneNumber: function(t) {
        if (console.log(t), "getPhoneNumber:ok" == t.detail.errMsg) {
            var o = {
                action: "bindPhone",
                contr: "user",
                token: wx.getStorageSync("token"),
                encryptedData: t.detail.encryptedData,
                iv: t.detail.iv
            };
            n.default.request(o, function(t) {
                e.onReady();
            });
        }
    },
    onShareAppMessage: function() {
        return {
            title: this.data.share.text,
            imageUrl: this.data.share.images,
            path: "bh_farm/pages/index/index?parent_id=" + this.data.share.member_id
        };
    },
    getUserInfo: function(t) {
        if ("getUserInfo:ok" == t.detail.errMsg) {
            var o = {
                action: "register",
                contr: "index",
                token: wx.getStorageSync("token"),
                encryptedData: t.detail.encryptedData,
                iv: t.detail.iv
            };
            n.default.request(o, function(t) {
                e.onReady();
            });
        }
    }
});